# -*- coding: utf-8 -*-
class Receivable < ActiveRecord::Base
  belongs_to :employee      #收款人员
  belongs_to :sale_order    #相关的销售订单
  belongs_to :customer      #客户
  belongs_to :sales_strategy  #销售策略
  belongs_to :auditor, :class_name => 'Employee', :foreign_key => 'auditor_id'

  scope :find_all, lambda { |conditionsStr,conditionsHash| { :conditions => [conditionsStr,conditionsHash],:include=>[:customer,:auditor,:employee,:sale_order],:order=> "updated_at DESC" }}
  scope :paginate, lambda { |start,limit| { :offset => start.to_i,:limit => limit.to_i }}
end
